package org.azmat.mybatis.Controller;

import org.azmat.mybatis.SQL.Entity.Classinfo;
import org.azmat.mybatis.SQL.Service.ClassinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ClassinfoController {

    @Autowired
    private ClassinfoService classinfoService;

    @GetMapping("/classinfos/{id}")
    public ModelAndView findClassinfoById(@PathVariable("id") int classni) {
        Classinfo classinfo = classinfoService.findClassinfoById(classni);
        ModelAndView modelAndView = new ModelAndView("classinfo");
        modelAndView.addObject("classinfo", classinfo);
        return modelAndView;
    }

}
